<?php

class UserControlController extends Controller
{
	public function actionIndex()
	{
		$this->render('index');
	}
	
	public function actionGestEmetteur($name)
	{
		try
		{		
			$connection=Yii::app()->db;
			$sql = "SELECT * FROM emetteur where login_emetteur='".$name."'";
			$command=$connection->createCommand($sql);			
			$row=$command->queryRow();
		}
		catch(Exception $e) 
		{
		   echo $e;
		}
		if(count($row)!=0)
			return false;
		else
			return true;
	}
	
	public function actionGuestPersonnel($name)
	{
		try
		{		
			$connection=Yii::app()->db;
			$sql = "SELECT * FROM personnel_technique where login_personnel='".$name."'";
			$command=$connection->createCommand($sql);			
			$row=$command->queryRow();
		}
		catch(Exception $e) 
		{
		   echo $e;
		}
		if(count($row)!=0)
			return false;
		else
			return true;
	}
	
	public function actionGuestAdmin()
	{
		$name = "admin"
		try
		{		
			$connection=Yii::app()->db;
			$sql = "SELECT * FROM personnel_technique where login_personnel='".$name."'";
			$command=$connection->createCommand($sql);			
			$row=$command->queryRow();
		}
		catch(Exception $e) 
		{
		   echo $e;
		}
		if(count($row)!=0)
			return false;
		else
			return true;
	}

	// Uncomment the following methods and override them if needed
	/*
	public function filters()
	{
		// return the filter configuration for this controller, e.g.:
		return array(
			'inlineFilterName',
			array(
				'class'=>'path.to.FilterClass',
				'propertyName'=>'propertyValue',
			),
		);
	}

	public function actions()
	{
		// return external action classes, e.g.:
		return array(
			'action1'=>'path.to.ActionClass',
			'action2'=>array(
				'class'=>'path.to.AnotherActionClass',
				'propertyName'=>'propertyValue',
			),
		);
	}
	*/
}